<template>
	<div class="wrapper customer-box" @keyup.enter="doLogin">
		<el-form label-position="top" :inline="true" v-model="filter" class="demo-form-inline">
			<el-row>
				<el-col :span="4">
					<el-form-item label="品牌名称:" >
						<!-- <el-input placeholder="品牌名称" v-model="filter.brandName" size="small"></el-input> -->
						<el-autocomplete v-model="filter.brandName" :fetch-suggestions="querySearch" placeholder="品牌名称"   size="small" @select="handleSelect"></el-autocomplete>
					</el-form-item>
				</el-col>

				<el-col :span="4">
					<el-form-item label="联系人:">
						 <el-input placeholder="联系人" v-model="filter.contactName" size="small"></el-input> 
						<!--<el-autocomplete v-model="filter.contactName" :fetch-suggestions="querySearchAsync" placeholder="联系人" @select="handleSelectAsync"></el-autocomplete>-->
					</el-form-item>
				</el-col>

				<el-col :span="4">
					<el-form-item label="手机号码:">
						<el-input placeholder="手机号码" v-model="filter.tel" size="small"></el-input>
					</el-form-item>
				</el-col>

				<el-col :span="4">
					<el-form-item label="品牌类型: " >

						<el-select v-model="filter.brandType" placeholder="请选择" size="small">
							<el-option v-for="item in brandtypes" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
						</el-select>
					</el-form-item>
				</el-col>

				<el-col :span="4">
					<el-form-item label="签约服务:">
						<el-select v-model="filter.signingserviceType" size="small">
							<el-option label="全部" value=""></el-option>
							<el-option label="投诉" value="1"></el-option>
							<el-option label="数据" value="2"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="4">
					<el-form-item label="知产员:">
						<el-input :disabled="true" v-show="readOnly" placeholder="知产员" v-model="seller" size="small"></el-input>
						<el-input v-show="!readOnly" readonly placeholder="知产员" v-model="seller" size="small" @focus="getOwnerData" icon="el-icon-search"></el-input>
					</el-form-item>
				</el-col>
			</el-row>

			<el-row>

				<el-col :span="4">
					<el-form-item label="购买员:">
						<!-- <el-input placeholder="购买员" v-model="filter.buyer" size="small"></el-input> -->
						<el-input :disabled="true" v-show="readOnlyBuy" placeholder="购买员" v-model="buyer" size="small"></el-input>
						<el-input v-show="!readOnlyBuy" readonly placeholder="购买员" v-model="buyer" size="small" @focus="getOwnerDataBuy" icon="el-icon-search"></el-input>
					</el-form-item>
				</el-col>

				<el-col :span="4">
					<el-form-item label="对接员:">
						<!-- <el-input placeholder="对接员" v-model="filter.abutment" size="small"></el-input> -->
						<el-input :disabled="true" v-show="readOnlyAbu" placeholder="对接员" v-model="abutmenter" size="small"></el-input>
						<el-input v-show="!readOnlyAbu" readonly placeholder="对接员" v-model="abutmenter" size="small" @focus="getOwnerDataOne" icon="el-icon-search"></el-input>
					</el-form-item>
				</el-col>

				<el-col :span="4">
					<el-form-item label="品牌状态: " >
						<el-select v-model="filter.brandStatus" placeholder="请选择" size="small">
							<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
						</el-select>
					</el-form-item>
				</el-col>

				<el-col :span="4">
					<el-form-item label="创建时间:">
						<el-date-picker size="small" v-model="GmtCreate" type="datetimerange" start-placeholder="开始日期"
										end-placeholder="结束日期" >
						</el-date-picker>
					</el-form-item>
				</el-col>
				
				<el-col :span="4">
                    <el-form-item label="下次联系时间:">
                        <el-date-picker
                                size="small"
                                v-model="PlanTime"
                                type="datetimerange"
								start-placeholder="开始日期"
								end-placeholder="结束日期">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
                
			</el-row>

			<el-row>
				<el-col :span="24" class="action_col">
					<el-form-item class="action_button_group_open">
						<el-button size="small" type="primary" @click="empty"><i class="fa fa-trash-o fa-lg"></i> 清空筛选条件
						</el-button>
						<el-button size="small" type="primary" @click="getCustomersA" icon="el-icon-search">查询</el-button>
					</el-form-item>
				</el-col>	
			</el-row>
		</el-form>

		<el-row>
			<el-button size="small" @click="transDialog"><i class="fa fa-share-alt"></i> 分配运营</el-button>
			<el-button size="small" @click="refresh"><i class="fa fa-refresh"></i> 刷新</el-button>
		</el-row>

		<el-row class="customer_row">
			<el-table border :data="customerList" v-model="customerList" style="width: 100%;" :default-sort="{prop: 'last_follow_time', order: 'desc'}" @selection-change="handleSelectionChange"  :row-class-name="tableRowClassName" >
				<el-table-column type="selection" width="55" className="asd" :selectable="numberCheck" >
				</el-table-column>
				<el-table-column prop="brandName" label="品牌名称" className="asds" min-width="100" 　align="center" >
					<template scope="scope">
						<div class="customer_col">
							<nuxt-link style="color: inherit" :to="{ path: '/brandadmin/brandDetail', query: { id: scope.row.id ,customerContactId: scope.row.customerContactId ,from: 'index',brandName: scope.row.brandName,flag:1}}">
								{{ scope.row.brandName}}
							</nuxt-link>
						</div>
					</template>
				</el-table-column>
				<el-table-column prop="contactName" label="联系人" align="center" min-width='110' className="asds"></el-table-column>
				<el-table-column prop="tel" label="手机号码" align="center" min-width='140' className="asds"></el-table-column>
				<el-table-column prop="brandTypeName" label="品牌类型" :render-header="renderHeader" min-width='117' align="center" className="asds"></el-table-column>
				
				
				<el-table-column prop="signingserviceTypeName" label="签约服务" align="center" min-width='120' className="asds"></el-table-column>
				<el-table-column prop="saleMemberName" label="销售员" align="center" min-width="80" className="asds"></el-table-column>
				<el-table-column prop="iprMemberName" label="知产员" align="center" min-width="80" className="asds"></el-table-column>
				<el-table-column prop="purchaseMemberName" label="购买员" align="center" min-width="80" className="asds"></el-table-column>
				<el-table-column prop="dockMemberName" label="对接员" align="center" min-width="80" className="asds"></el-table-column>
				<el-table-column prop="brandStatusName" label="状态" align="center" min-width='120' className="asds"></el-table-column>
				<el-table-column label="创建时间" :render-header="renderHeader" prop="createTime" min-width="179" align="center" className="asds"></el-table-column>
				<el-table-column label="下次联系时间" :render-header="renderHeader" prop="planTime" min-width="179" align="center" className="asds"></el-table-column>
				
				<el-table-column prop="action" label="操作" fixed="right" align="center" min-width="300" className="asds">
					<template scope="scope">
						<div class="operator-btn">
							<el-button type="primary" icon="el-icon-caret-right" size="mini" @click="stopBox(scope.row)" v-show="scope.row.brandStatusName == '正常'|| scope.row.brandStatusName == '屏蔽'	">暂停
							</el-button>
							<el-button type="primary" icon="el-icon-caret-right" size="mini" @click="cancelstopBox(scope.row)" v-show="scope.row.brandStatusName == '暂停'||scope.row.brandStatusName == '暂停,屏蔽'">取消暂停 </el-button>
							<el-button type="primary" icon="el-icon-document" size="mini" @click="hideBox(scope.row)" v-show="scope.row.brandStatusName == '正常'||scope.row.brandStatusName == '暂停'">屏蔽
							</el-button>
							<el-button type="primary" icon="el-icon-document" size="mini" @click="cancelhideBox(scope.row)" v-show="scope.row.brandStatusName == '屏蔽'||scope.row.brandStatusName == '暂停,屏蔽'">取消屏蔽
							</el-button>
							<el-button type="primary" icon="el-icon-document" size="mini" @click="examineBox(scope.row)" v-show="scope.row.brandStatusName == '待审核'">审核
							</el-button>
							<el-button type="primary" icon="el-icon-document" size="mini" @click="alginexamineBox(scope.row)" v-show="scope.row.brandStatusName == '审核不通过'">再次审核
							</el-button>
							<el-button type="success" icon="el-icon-edit" size="mini" @click="openBox(scope.row)" v-show="scope.row.brandStatusName == '正常' && scope.row.hasBrandAccount == 0">开通维权通
							</el-button>
							<el-button type="danger" icon="el-icon-delete" size="mini" @click="deleteBox(scope.row)">删除
							</el-button>
						</div>
					</template>
				</el-table-column>
			</el-table>
		</el-row>

		<el-row class="paging">
			<el-pagination @current-change="handleCurrentChange" @size-change="handleSizeChange" :current-page="pagingData.pageNum" :page-sizes="pagingData.pageSizes" :page-size="50" layout="total, sizes, prev, pager, next, jumper" :total="pagingData.total">
			</el-pagination>
		</el-row>

		<!--*****************知产员框************-->
		<el-dialog title="选择知产员" :visible.sync="dialogVisible" @close="closeOwnerDialog">
			<el-row style="margin-bottom: 20px">
				<el-col :span="12">
					<el-select v-model="ownerFilter.deptId" placeholder="请选择部门" size="small" @change="selectSeller">
						<el-option v-for="(item,index) in ownerOptions" :key="index" :label="item.name" :value="item.id">
						</el-option>

					</el-select>
				</el-col>
			</el-row>
			<el-table :data="ownerData" style="width: 100%" max-height="541" @selection-change="handleOwnerSelectionChange">
				<el-table-column type="selection" width="55"></el-table-column>
				<el-table-column prop="account" label="用户名" width="140"></el-table-column>
				<el-table-column prop="name" label="用户姓名"></el-table-column>
				<el-table-column prop="departmentName" label="部门"></el-table-column>
			</el-table>
			<el-row class="paging">
				<el-pagination @current-change="ownerHandleCurrentChange" @size-change="ownerHandleSizeChange" :current-page="ownerPage.pageNum" :page-sizes="ownerPage.pageSizes" :page-size="10" layout="total, sizes, prev, pager, next, jumper" :total="ownerPage.total">
				</el-pagination>
			</el-row>

			<el-row style="margin-top: 20px">
				<el-col :span="12">
					<el-button type="primary" class="top_save" @click="onSubmit" size="small"><i class="fa fa-save"></i>　保存</el-button>
				</el-col>
				<el-col :span="12">
					<el-button type="danger" class="top_close" @click="dialogVisible = false" size="small"><i class="fa fa-sign-out"></i>关闭</el-button>
				</el-col>
			</el-row>
		</el-dialog>

		<!-- 购买员弹窗 -->
		<el-dialog title="选择购买员" :visible.sync="dialogVisibleBuy" @close="closeBuyerDialog">
			<el-row style="margin-bottom: 20px">
				<el-col :span="12">
					<el-select v-model="buyerFilter.deptId" placeholder="请选择部门" size="small" @change="selectSellerBuy">
						<el-option v-for="(item,index) in buyerOptions" :key="index" :label="item.name" :value="item.id">
						</el-option>

					</el-select>
				</el-col>
			</el-row>
			<el-table :data="buyerData" style="width: 100%" max-height="541" @selection-change="handleBuyerSelectionChange">
				<el-table-column type="selection" width="55"></el-table-column>
				<el-table-column prop="account" label="用户名" width="140"></el-table-column>
				<el-table-column prop="name" label="用户姓名"></el-table-column>
				<el-table-column prop="departmentName" label="部门"></el-table-column>
			</el-table>
			<el-row class="paging">
				<el-pagination @current-change="buyerHandleCurrentChange" @size-change="buyerHandleSizeChange" :current-page="buyerPage.pageNum" :page-sizes="buyerPage.pageSizes" :page-size="10" layout="total, sizes, prev, pager, next, jumper" :total="buyerPage.total">
				</el-pagination>
			</el-row>

			<el-row style="margin-top: 20px">
				<el-col :span="12">
					<el-button type="primary" class="top_save" @click="buyonSubmit" size="small"><i class="fa fa-save"></i>　保存</el-button>
				</el-col>
				<el-col :span="12">
					<el-button type="danger" class="top_close" @click="dialogVisibleBuy = false" size="small"><i class="fa fa-sign-out"></i>关闭</el-button>
				</el-col>
			</el-row>
		</el-dialog>

		<!--对接员弹窗-->
		<el-dialog title="选择对接员" :visible.sync="dialogVisibleOne" @close="closeIOneerDialog">
			<el-row style="margin-bottom: 20px">
				<el-col :span="12">
					<el-select v-model="oneerFilter.deptId" placeholder="请选择部门" size="small" @change="selectSellerOne">
						<el-option v-for="(item,index) in oneerOptions" :key="index" :label="item.name" :value="item.id">
						</el-option>

					</el-select>
				</el-col>
			</el-row>
			<el-table :data="oneerData" style="width: 100%" max-height="541" @selection-change="handleOneerSelectionChange">
				<el-table-column type="selection" width="55"></el-table-column>
				<el-table-column prop="account" label="用户名" width="140"></el-table-column>
				<el-table-column prop="name" label="用户姓名"></el-table-column>
				<el-table-column prop="departmentName" label="部门"></el-table-column>
			</el-table>
			<el-row class="paging">
				<el-pagination @current-change="oneerHandleCurrentChange" @size-change="oneerHandleSizeChange" :current-page="oneerPage.pageNum" :page-sizes="oneerPage.pageSizes" :page-size="10" layout="total, sizes, prev, pager, next, jumper" :total="oneerPage.total">
				</el-pagination>
			</el-row>

			<el-row style="margin-top: 20px">
				<el-col :span="12">
					<el-button type="primary" class="top_save" @click="oneonSubmit" size="small"><i class="fa fa-save"></i>　保存</el-button>
				</el-col>
				<el-col :span="12">
					<el-button type="danger" class="top_close" @click="dialogVisibleOne = false" size="small"><i class="fa fa-sign-out"></i>关闭</el-button>
				</el-col>
			</el-row>
		</el-dialog>

		<!--****************审核弹窗******************-->
		<el-dialog @close="()=>{this.examineDialog = false}" :visible.sync="examineDialog" size="tiny" title="审核" class="shenhedialog">
			<el-form>
				<el-form-item label="品牌名称：">
					<div>{{shenhe.brandName}}</div>
				</el-form-item>
				<el-form-item label="审核结果：">
					<el-radio v-model="radio" label="1"> 通过</el-radio>
					<el-radio v-model="radio" label="2">不通过</el-radio>
				</el-form-item>
				<el-form-item label="原因:" v-if="radio == 2">
					<el-input type="textarea" :rows="6" placeholder="请输入原因" v-model="shenhe.because"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" style="margin-left:27% ;" @click="shenheCommit(shenhe.id,shenhe.because)">提交</el-button>
				</el-form-item>
			</el-form>
		</el-dialog>

		<!--***************再次审核弹窗************************-->
		<el-dialog @close="()=>{this.alginexamineDialog = false}" :visible.sync="alginexamineDialog" size="tiny" title="再次审核">
			<el-form>
				<el-form-item label="品牌名称：">
					<div>{{alginshenhe.brandname}}</div>
				</el-form-item>
				<el-form-item label="审核记录：" class="shenhejilu">
					<div class="reasons">审核结果：{{alginshenhe.aliginResult}}</div>
					<div class="reasons">原因：{{alginshenhe.alginBecause}}</div>
					<div class="reasons">审核人：{{alginshenhe.memberName}}</div>
					<div class="reasons">审核时间：{{alginshenhe.alginDate}}</div>
				</el-form-item>
				<el-form-item label="审核结果：">
					<el-radio v-model="radio" label="1"> 通过</el-radio>
					<el-radio v-model="radio" label="2">不通过</el-radio>
				</el-form-item>
				<el-form-item label="原因:" v-if="radio == 2">
					<el-input type="textarea" :rows="6" placeholder="请输入原因" v-model="alginshenhe.because"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" style="margin-left:27% ;" @click="againCommit(alginshenhe.id,alginshenhe.because)">提交</el-button>
				</el-form-item>
			</el-form>
		</el-dialog>

	</div>
</template>

<script>
	import Vue from 'vue'
	import { Row, Col, Form, FormItem, Tooltip, Input, Select, Option, DatePicker, ButtonGroup, Tree, Button, Table, TableColumn, Checkbox, CheckboxGroup, Message, MessageBox, Pagination, Dialog, Radio, Autocomplete } from 'element-ui';
	import { mapGetters, mapActions, mapMutations } from 'vuex';
	import { SHOW_MESSAGE, MESSAGE_IDS, MESSAGE_NAMES, MESSAGE_TELS } from '../../store/mutation-types/template/index';
	import { getDate, returnDate, getArraySub, getLevelName, validTel, setToken, getCookie } from '../../utils/auth';

	Vue.use(Row);
	Vue.use(Radio);
	Vue.use(Col);
	Vue.use(Form);
	Vue.use(FormItem);
	Vue.use(Input);
	Vue.use(Select);
	Vue.use(Option);
	Vue.use(DatePicker);
	Vue.use(ButtonGroup);
	Vue.use(Button);
	Vue.use(Table);
	Vue.use(TableColumn);
	Vue.use(Checkbox);
	Vue.use(CheckboxGroup);
	Vue.use(Pagination);
	Vue.use(Tooltip);
	Vue.use(Dialog);
	Vue.use(Tree);
	Vue.use(Autocomplete);

	Vue.prototype.$message = Message;
	Vue.prototype.$confirm = MessageBox.confirm;

	export default {
		head() {
			return {
				title: "日历品牌列表",
              meta: [
                  { hid: 'complaintlen', name: 'complaintlen', content: 'complaintlen'}
              ]
			}
		},
		data() {
			return {
				
				//品牌状态
				options: [{
						value: '',
						label: '全部'
					},
					{
						value: '1',
						label: '正常'
					},
					{
						value: '0',
						label: '待审核'
					},
					{
						value: '-6',
						label: '审核不通过'
					},
					{
						value: '-7',
						label: '屏蔽'
					},
					{
						value: '-8',
						label: '暂停'
					},
					{
						value: '2',
						label: '待分配'
					},
					{
						value: '-7,-8',
						label: '暂停,屏蔽'
					}
				],
				brandtypes: [{
						value: '',
						label: '全部'
					},
					{
						value: '6',
						label: '0类(未开始操作客户)'
					},
					{
						value: '1',
						label: '1类(常规客户)'
					},
					{
						value: '2',
						label: '2类(接触频繁客户)'
					},
					{
						value: '3',
						label: '3类(重点客户)'
					},
					{
						value: '4',
						label: '6类(断约客户)'
					}
				],
				textarea: '', //审核弹窗的 不通过的 原因 文本域
				radio: '1', //审核弹窗的审核结果默认通过
				alginexamineDialog: false, //再次审核弹窗默认false
				examineDialog: false, //审核弹窗 默认false
				shenhe: {
					brandName: '', //审核弹窗的品牌名称
					because: '', //审核弹窗的不通过原因
					id: ''
				},
				alginshenhe: {
					brandname: "", //再次审核弹窗的品牌名称
					aliginResult: '', //再次审核弹窗的 审核记录的审核结果
					alginBecause: '', //再次审核弹窗审核记录的不通过原因
					memberName: "", //再次审核弹窗审核记录的审核人
					alginDate: "", //再次审核弹窗审核记录的审核时间
					id: '',
					because: '',
				},
				title: '日历品牌列表', //页面内部tab的显示信息
				tabName: '日历品牌列表', //页面内部tab的显示信息
				seller: '', //知产员
				buyer: '', //购买员
				abutmenter: '', //对接员
				ownerOptions: [], //销售员部门下拉
				buyerOptions: [], //购买员部门下拉
				oneerOptions: [], //对接员部门下拉
				ownerData: [], //销售员弹窗的表格总信息
				buyerData: [], //购买员弹窗的表格总信息
				oneerData: [], //购买员弹窗的表格总信息
				ownerSelection: [], //销售员弹窗的 销售员多选
				buyerSelection: [], //购买员弹窗的 购买员多选
				oneerSelection: [], //购买员弹窗的 购买员多选
				dialogVisible: false, //销售员员弹窗默认 不显示
				dialogVisibleBuy: false, //购买员弹窗默认不显示
				dialogVisibleOne: false, //对接员弹窗默认不显示

				filter: {
					energencyFlag:'',
					brandName: '', //品牌名称
					contactName: '', //联系人
					tel: '', //联系人手机号
					brandType: '', //品牌类型下拉 框
					brandStatusName: '', //品牌状态下拉框
					signingserviceType: '', //签约服务
					knowledgeIds: '', //知产员id(数组)
					purchaseIds: '', //购买员id(数组)
					dockIds: '', //对接员id(数组)
					brandStatus: '', //品牌状态
					pageSize: 50, // 每页条数
					pageNum: 1, //页码
					createTimeBegin: '', //创建时间开始
					createTimeEnd: '', //创建时间结束
					planTimeBegin: '',   //下次联系时间开始
                    planTimeEnd: '',  //下次联系时间结束
					sortField: 'last_follow_time', //排序呢方式按照品牌类型
					sortOrder: 'desc', //排序方式
					calendarFlag:1,//判断是否是日历页面跳转过来的
				},
				GmtCreate: [], //创建时间
				PlanTime: [],   //下次联系时间
				multipleSelection: [], // checkbox选中客户列表数据
				deptList: [], // 部门列表
				//				userFilter: {
				//					pageNum: 1,
				//					pageSize: 50,
				//					deptId: ''
				//				},//分配二级弹窗的请选择部门
				ownerPage: {
					pageSizes: [10, 20, 30], // 销售员弹窗的，每页可选条数列表
					total: 0,
					pageNum: 1
				},
				buyerPage: {
					pageSizes: [10, 20, 30], // 购买员弹窗的，每页可选条数列表
					total: 0,
					pageNum: 1
				},
				oneerPage: {
					pageSizes: [10, 20, 30], // 对接员弹窗的，每页可选条数列表
					total: 0,
					pageNum: 1
				},
				ownerFilter: {
					pageNum: 1, //销售员的弹窗请选择部门
					pageSize: 10,
					deptId: ''
				},
				buyerFilter: {
					pageNum: 1, //购买员的弹窗请选择部门
					pageSize: 10,
					deptId: ''
				},
				oneerFilter: {
					pageNum: 1, //对接员的弹窗请选择部门
					pageSize: 10,
					deptId: ''
				},
				pagingData: {
					pageSizes: [10, 20, 50], // 客户列表的,每页可选条数列表
					total: 0,
					pageNum: 1
				},
				// dialogCurrentRow: null, // dialog高亮的行
				// transSelectedUserId: null, // dialog单击选择的用户id

				transSelectedUserName: '', //dialog点击选择的用户名字
				departmentRoleId: '', // 当前登录用户的部门角色id
				customerList: [], //品牌列表
				brandList: [], //当前登录人的列表
				contactList: [], //联系人的模糊搜索
				sortOrder: true,
				readOnly: true, //销售员选项是否禁用
				readOnlyBuy: true, //购买员选项是否禁用
				readOnlyAbu: true, //对接员 选项是否禁用
				stopinglist: true, //暂停按钮是否显示
				cancelstopinglist: true, //取消暂停按钮是否显示
				cancelhidelist: true, //取消屏蔽按钮是否显示
				examinelist: true, //审核按钮是否显示
				alginexaminelist: true, //再次审核按钮是否显示
				hidelist: true, //屏蔽按钮是否显示
				openlist: true, //开通维权通按钮是否显示
				ownerRows: [],
				buyerRows: [],
				oneerRows: [],
				message: {
					ids: [],
					names: [],
					tels: []
				},
//				userData: {
//					userName: '',
//					userId: '',
//					deptCode: ''
//				},
				backSeller: '',//知产
				backBuyer: '',//购买
				backOneer: '',//对接
				backId: '',
				backIdBuyer: '',
				backIdOneer: '',
//				pickerOptions1: { //创建时间只能选择今天之前的
//                  disabledDate(time) {
//                      return time.getTime() > Date.now() - 8.64e7;
//                  }
//              },
				
			}
		},
		computed: {
			...mapGetters([
				"myCustomerFilter",
				"myBrandFilter"
			])
		},
		methods: {

			//点击enter实现搜索
			doLogin(event) {
				var e = event || window.event || arguments.callee.caller.arguments[0];
				if(e && e.keyCode == 13) {
					this.getCustomers();
				}
			},
			//点击刷新页面全局刷新
			 refresh() {
				window.location.reload();
			},
			
			//搜索条件加入store
//			setFilterCookie() {
//				let datas = JSON.stringify(this.filter);
//				this.$store.commit('MY_CUSTOMER_FILTER', {
//					datas
//				});
//			},

			renderHeader(h, { column, $index }){
                switch ($index) {
                	 case 4:
                        return (
                            <div style="color: #1488FF;cursor: pointer;" on-click={ () => this.sortData('brand_type') }>品牌类型&nbsp;<i class="fa fa-sort"></i></div>
                            );
                        break;
                    case 11:
                        return (
                            <div style="color: #1488FF;cursor: pointer;" on-click={ () => this.sortData('gmt_create') }>创建时间&nbsp;<i class="fa fa-sort"></i></div>
                            );
                        break;
                    case 12:
                        return (
                            <div style="color: #1488FF;cursor: pointer;" on-click={ () => this.sortData('plan_time') }>下次联系时间&nbsp;<i class="fa fa-sort"></i></div>
                            );
                        break;
                    
                    
                }
            },
			 sortData(type) {
                this.filter.sortField = type;
                this.filter.sortOrder = this.sortOrder == true ? 'asc':'desc';
                this.sortOrder = !this.sortOrder;
                this.getCustomers();
            },

			empty() {
				this.filter = {
					energencyFlag:'',
					brandName: '', //客户名称
					contactName: '', //联系人
					tel: '', //手机号
					knowledgeIds: '', //知产员ids（数组）
					purchaseIds: '', //购买员ids（数组）
					dockIds: '', //对接员ids（数组）
					brandStatus: '', //品牌状态
					signingserviceType: '', //签约服务
					pageSize: 50, // 每页条数
					pageNum: 1,
					createTimeBegin: '', //创建时间开始
					createTimeEnd: '', //创建时间结束
					planTimeBegin: '',   //下次联系时间开始
                    planTimeEnd: '',  //下次联系时间结束
					sortField: 'last_follow_time', //按照品牌类型排序
					sortOrder: 'desc',
					brandType: '',
					brandStatusName: '',
					calendarFlag:0,
				};

				this.GmtCreate = []; //创建时间
				this.PlanTime = [];   //下次联系时间
				if(this.readOnly) {
					this.seller = this.backSeller;
					this.filter.knowledgeIds = this.backId;
				} else {
					this.seller = '';
					this.filter.knowledgeIds = '';
				}

				if(this.readOnlyBuy) {
					this.buyer = this.backBuyer;
					this.filter.purchaseIds = this.backId;
				} else {
					this.buyer = '';
					this.filter.purchaseIds = '';
				}

				if(this.readOnlyAbu) {
					this.abutmenter = this.backOneer;
					this.filter.dockIds = this.backId;
				} else {
					this.abutmenter = '';
					this.filter.dockIds = '';
				}

//				this.setFilterCookie();
			},



			// 获取品牌列表
			getCustomers() {
				if(this.filter.tel && validTel(this.filter.tel) == false) {
					Message.warning({
						message: '手机号码格式不正确'
					});
					return;
				}
				if(this.GmtCreate && this.GmtCreate[0]) {
					this.filter.createTimeBegin = this.GmtCreate[0] ? getDate(this.GmtCreate[0], true) : '';
					this.filter.createTimeEnd = this.GmtCreate[1] ? getDate(this.GmtCreate[1], true) : '';
				} else {
					this.filter.createTimeBegin = '';
					this.filter.createTimeEnd = ''
				}
				
				if (this.PlanTime&&this.PlanTime[0]) {
                    this.filter.planTimeBegin = this.PlanTime[0]?getDate(this.PlanTime[0],true):'';
                    this.filter.planTimeEnd = this.PlanTime[1]?getDate(this.PlanTime[1],true):'';
                }else{
                    this.filter.planTimeBegin =''
                    this.filter.planTimeEnd = ''
                }
				
//				this.setFilterCookie();
				this.$store.dispatch('brandList', this.filter)
					.then((response) => {
						if(!response) {
							return
						}

						// console.log(response)
						this.contactList = response.data.data.list;
			            this.contactList.map(listOne=>{
			              Vue.set(listOne,'value',listOne.contactName)
			            })

						let result = response.data;
						if(result.code == 0 && result.data) {
							this.customerList = result.data.list;
							for(var i = 0; i < this.customerList.length; i++) {
								if(this.customerList[i].brandTypeName) {
									this.customerList[i].brandTypeName = this.customerList[i].brandTypeName.slice(0, 2)
								}
								if(this.customerList[i].brandStatus == 2) {
									this.customerList[i].brandStatusName = "待分配";
								}
								if(this.customerList[i].brandStatus == 1) {
									this.customerList[i].brandStatusName = "正常";
								}
								if(this.customerList[i].brandStatus == -6) {
									this.customerList[i].brandStatusName = "审核不通过";
								}
								if(this.customerList[i].brandStatus == 0) {
									this.customerList[i].brandStatusName = "待审核";
								}
								if(this.customerList[i].brandStatus == -7) {
									this.customerList[i].brandStatusName = "屏蔽";
								}
								if(this.customerList[i].brandStatus == '-7,-8') {
									this.customerList[i].brandStatusName = "暂停,屏蔽";
								}
								if(this.customerList[i].brandStatus == -8) {
									this.customerList[i].brandStatusName = "暂停";
								}
							}
							this.pagingData.total = result.data.total;
							this.pagingData.pageNum = result.data.pageNum > 0 ? result.data.pageNum : 1;
						} else if(result.data = null) {
							this.pagingData.total = 0;
							this.pagingData.pageNum = 0;
						} else {
							this.customerList = [];
							this.pagingData.total = 0;
							this.pagingData.pageNum = 0;
						}
					})
			},
			//点击查询按钮
			getCustomersA() {
				this.filter.calendarFlag = 0 ;
				this.getCustomers();
			},
			
			// 品牌列表多选
			handleSelectionChange(val) {
				let ids = [];
				for(let i = 0; i < val.length; i++) {
					ids.push(val[i].id);
				}
				this.multipleSelection = ids;
				this.message.ids = ids;
			},

			
			//审核弹窗
			examineBox(row) {
				this.examineDialog = true;
				this.shenhe.brandName = row.brandName;
				this.shenhe.because = '';
				this.shenhe.id = row.id
			},
			//审核弹窗 里的点击提交
			shenheCommit(val, reson) {
				if(this.radio == 1) { //调用通过接口
					this.$store.dispatch('addBrandAudit', {
							brandId: val,
							result: 1
						})
						.then((response) => {
							let result = response.data;
							if(result.successed && result.successed == true) {
								this.getCustomers({
									pageNum: 1,
									pageSize: 10
								});
								if(result.code == 0) {
									Message.success({
										message: '审核提交成功'
									});
								}
							} else {
								Message.error({
									message: '提交失败'
								})
							}
						})
				} else { //调用不通过接口||并且传递原因
					this.$store.dispatch('addBrandAudit', {
							brandId: val,
							result: -1,
							reson: reson
						})
						.then((response) => {
							let result = response.data;
							if(result.successed && result.successed == true) {
								this.getCustomers({
									pageNum: 1,
									pageSize: 10
								});
								if(result.code == 0) {
									Message.success({
										message: '审核提交成功'
									});
								}
							} else {
								Message.error({
									message: '提交失败'
								})
							}
						})
				}
				this.examineDialog = false;
			},
			//再次审核弹窗
			alginexamineBox(row) { //点击  再次审核  的时候   需要调用审核记录的内容，赋值给  alginshenhe
				this.alginexamineDialog = true;
				this.$store.dispatch('getBrandAudit', {
					brandId: row.id
				}).then((response) => {
					let result = response.data;
					if(result.successed == true && result.data !== null) {
						this.alginshenhe.brandname = result.data.brandName;
						this.alginshenhe.alginBecause = result.data.reson;
						this.alginshenhe.aliginResult = result.data.resultNane;
						this.alginshenhe.alginDate = result.data.gmtCreate;
						this.alginshenhe.memberName = result.data.memberName;
						this.alginshenhe.id = result.data.brandId;
						this.alginshenhe.because = "";
					}
				})
			},
			//再次审核弹窗 里的提交
			againCommit(id, reson) {
				this.alginexamineDialog = false;
				if(this.radio == 1) { //调用通过接口
					this.$store.dispatch('addBrandAudit', {
							brandId: id,
							result: 1
						})
						.then((response) => {
							let result = response.data;
							if(result.successed && result.successed == true) {
								this.getCustomers({
									pageNum: 1,
									pageSize: 50
								});
								if(result.code == 0) {
									Message.success({
										message: '再次审核提交成功'
									});
								}

							} else {
								Message.error({
									message: '再次审核提交失败'
								})
							}
						})
				} else if(this.radio == 2) { //调用不通过接口||并且传递原因
					this.$store.dispatch('addBrandAudit', {
							brandId: id,
							result: -1,
							reson: reson
						})
						.then((response) => {
							let result = response.data;
							if(result.successed == true ) {
								this.getCustomers({
									pageNum: 1,
									pageSize: 50
								});
								if(result.code == 0) {
									Message.success({
										message: '再次审核提交成功'
									});
								}

							} else {
								Message.error({
									message: '再次提交失败'
								})
							}
						})
				}
			},
			//开通维权通 的跳转
			openBox(row) {
				this.$router.push({
					path: '/brandadmin/openRights?id=' + row.id
				});
			},

			// 删除品牌弹框
			deleteBox(row) {
				MessageBox.confirm('确认　删除客户：　' + row.brandName + '吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						this.deleteCustomer(row.id);
					})
					.catch(() => {
						Message.info({
							message: '已取消删除'
						});
					});
			},
			//暂停弹窗
			stopBox(row) {
				MessageBox.confirm('确认　暂停：　' + row.brandName + '吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						this.stopCustomer(row.id);
					})
					.catch(() => {
						Message.info({
							message: '已取消暂停'
						});
					});
			},
			//取消暂停弹窗
			cancelstopBox(row) {
				MessageBox.confirm('确定　取消暂停：　' + row.brandName + '吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						this.cancelstopCustomer(row.id);
					})
					.catch(() => {
						Message.info({
							message: '暂未取消暂停'
						});
					});
			},
			//屏蔽弹窗
			hideBox(row) {
				MessageBox.confirm('确认　屏蔽：　' + row.brandName + '吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						this.hideCustomer(row.id);
					})
					.catch(() => {
						Message.info({
							message: '已取消屏蔽'
						});
					});
			},
			//取消屏蔽弹窗
			cancelhideBox(row) {
				MessageBox.confirm('确认　取消屏蔽：　' + row.brandName + '吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						this.cancelhideCustomer(row.id);
					})
					.catch(() => {
						Message.info({
							message: '暂未取消屏蔽'
						});
					});
			},
			// 删除品牌
			deleteCustomer(id) {
				this.$store.dispatch('deleteBrand', {
						brandId: id
					})
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.successed && result.successed == true) {
							this.getCustomers({
								pageNum: 1,
								pageSize: 10
							});
							this.getBrandList();
							if(result.code == 103) {

							} else {
								Message.success({
									message: '删除成功'
								});
							}

						} else {
							Message.error({
								message: '删除失败'
							})
						}
					})
			},
			//暂停品牌
			stopCustomer(id) {
				this.$store.dispatch('updateBrandStatus', {
						brandId: id,
						updateType: 2
					})
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.successed && result.successed == true) {
							this.getCustomers({
								pageNum: 1,
								pageSize: 10
							});
							if(result.code == 103) {

							} else {
								Message.success({
									message: '暂停成功'
								});
							}

						} else {
							Message.error({
								message: '暂停失败'
							})
						}
					})
			},
			//取消暂停品牌
			cancelstopCustomer(id) {
				this.$store.dispatch('updateBrandStatus', {
						brandId: id,
						updateType: 4
					})
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.successed && result.successed == true) {
							this.getCustomers({
								pageNum: 1,
								pageSize: 10
							});
							if(result.code == 103) {

							} else {
								Message.success({
									message: '取消暂停成功'
								});
							}

						} else {
							Message.error({
								message: '取消暂停失败'
							})
						}
					})
			},
			//屏蔽品牌
			hideCustomer(id) {
				this.$store.dispatch('updateBrandStatus', {
						brandId: id,
						updateType: 1
					})
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.successed && result.successed == true) {
							this.getCustomers({
								pageNum: 1,
								pageSize: 10
							});
							if(result.code == 103) {

							} else {
								Message.success({
									message: '屏蔽成功'
								});
							}

						} else {
							Message.error({
								message: '屏蔽失败'
							})
						}
					})
			},
			//取消屏蔽用户
			cancelhideCustomer(id) {
				this.$store.dispatch('updateBrandStatus', {
						brandId: id,
						updateType: 3
					})
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.successed && result.successed == true) {
							this.getCustomers({
								pageNum: 1,
								pageSize: 10
							});
							if(result.code == 103) {

							} else {
								Message.success({
									message: '取消屏蔽成功'
								});
							}

						} else {
							Message.error({
								message: '取消屏蔽失败'
							})
						}
					})
			},
			// 分配运营弹窗
			transDialog() {
				if(this.multipleSelection == '') {
					this.$message.error('请先选择品牌');
					return;
				} else {
//					console.log(this.multipleSelection)
					this.dialogFormVisible = true;
					this.$router.push({
						path: '/brandadmin/distributionOperation',
						query: {
							id: this.multipleSelection
						}
					});
				}
			},
			//列表的分页器
			handleCurrentChange(val) {
				this.filter.pageNum = val;
				this.getCustomers(this.filter);
			},
			//列表的分页器
			handleSizeChange(val) {
				this.filter.pageSize = val;
				this.filter.pageNum = 1;
				this.getCustomers(this.filter);
			},
			//是否重要 底色高亮显示
			tableRowClassName(row, index) {
//				 console.log(row,index)
				if(row.energencyFlag == '1') {
					return 'info-row';
				}
				return '';
			},
			numberCheck(row,index) {
//				console.log(row,index);
				if(row.brandStatusName == '待审核' || row.brandStatusName == '审核不通过'){
					return false
				}
				return true
			},
			
            sortData(type) {
                this.filter.sortField = type;
                this.filter.sortOrder = this.sortOrder == true ? 'asc':'desc';
                this.sortOrder = !this.sortOrder;
                this.getCustomers();
            },
			
			
			//获取登录的用户信息
			getUserData() {
				this.$store.dispatch('getUserPersonalData')
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
//						console.log(result)
						if(result.code === 0) {
							if(result.data && result.data.leaderType == 0) {

								this.seller = result.data.name;
								this.buyer = result.data.name;
								this.abutmenter = result.data.name;

								this.backSeller = result.data.name;
								this.backBuyer = result.data.name;
								this.backOneer = result.data.name;

								this.backId = result.data.id;
								this.backIdBuyer = result.data.id;
								this.backIdOneer = result.data.id;

								this.filter.knowledgeIds = result.data.id;
								this.filter.purchaseIds = result.data.id;
								this.filter.dockIds = result.data.id;

								this.readOnly = true;
								this.readOnlyBuy = true;
								this.readOnlyAbu = true;

							} else {
								this.readOnly = false;
								this.readOnlyBuy = false;
								this.readOnlyAbu = false;

							}
							this.getCustomers();
						}
					})
			},
			//知产员输入框获取焦点的时候调用此函数
			getOwnerData() {
				this.dialogVisible = true;
				this.filter.knowledgeIds = '';
				this.filter.dockIds = '';
				this.filter.purchaseIds = '';
				this.getUserOwnerData();
				this.getOwnerDeptment();
			},
			//购买员输入框获取焦点的时候调用此函数
			getOwnerDataBuy() {
				this.dialogVisibleBuy = true;
				this.filter.knowledgeIds = '';
				this.filter.dockIds = '';
				this.filter.purchaseIds = '';
				this.getUserBuyerData();
				this.getBuyerDeptment();
			},
			//对接员输入框获取焦点的时候调用此函数
			getOwnerDataOne() {
				this.dialogVisibleOne = true;
				this.filter.knowledgeIds = '';
				this.filter.dockIds = '';
				this.filter.purchaseIds = '';
				this.getUserOneerData();
				this.getOneerDeptment();
			},
			//知产员的=========获取销售员列表
			getUserOwnerData() {
				this.$store.dispatch('getUserOwnerData', this.ownerFilter)
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.code === 0) {
							this.ownerData = result.data.list;
							this.ownerPage.total = result.data.total;
							this.ownerPage.pageNum = result.data.pageNum;
						}
					})
			},
			//购买员的=========获取购买员列表
			getUserBuyerData() {
				this.$store.dispatch('getUserOwnerData', this.buyerFilter)
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.code === 0) {
							this.buyerData = result.data.list;
							this.buyerPage.total = result.data.total;
							this.buyerPage.pageNum = result.data.pageNum;
						}
					})
			},
			//对接员的=========获取对接员列表
			getUserOneerData() {
				this.$store.dispatch('getUserOwnerData', this.oneerFilter)
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.code === 0) {
							this.oneerData = result.data.list;
							this.oneerPage.total = result.data.total;
							this.oneerPage.pageNum = result.data.pageNum;
						}
					})
			},
			//知产员的====获取销售员部门下拉框
			getOwnerDeptment() {
				this.$store.dispatch('getOwnerDeptment')
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.code === 0) {
							this.ownerOptions = result.data;
						}
					})
			},
			//购买员的===获取购买员部门下拉框
			getBuyerDeptment() {
				this.$store.dispatch('getOwnerDeptment')
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.code === 0) {
							this.buyerOptions = result.data;
						}
					})
			},
			//对接员的=== 获取对接员部门的下拉框
			getOneerDeptment() {
				this.$store.dispatch('getOwnerDeptment')
					.then((response) => {
						if(!response) {
							return
						}
						var result = response.data;
						if(result.code === 0) {
							this.oneerOptions = result.data;
						}
					})
			},
			//知产员的=========销售员多选
			handleOwnerSelectionChange(selection) {
				let names = [];
				let ids = [];
				for(let i = 0; i < selection.length; i++) {
					names.push(selection[i].name);
					ids.push(selection[i].id)
				}
				this.ownerRows = ids;
				this.ownerSelection = names;
			},
			//购买员的=========购买员多选
			handleBuyerSelectionChange(selection) {
				let names = [];
				let ids = [];
				for(let i = 0; i < selection.length; i++) {
					names.push(selection[i].name);
					ids.push(selection[i].id)
				}
				this.buyerRows = ids;
				this.buyerSelection = names;
			},
			//对接员的====对接员的多选
			handleOneerSelectionChange(selection) {
				let names = [];
				let ids = [];
				for(let i = 0; i < selection.length; i++) {
					names.push(selection[i].name);
					ids.push(selection[i].id)
				}
				this.oneerRows = ids;
				this.oneerSelection = names;
			},
			//知产员弹窗的 保存 
			onSubmit() {
				this.seller = this.ownerSelection.join(',');
				this.filter.knowledgeIds = this.ownerRows.join(',');
				this.dialogVisible = false;
			},
			//购买员弹窗的 保存
			buyonSubmit() {
				this.buyer = this.buyerSelection.join(',');
				this.filter.purchaseIds = this.buyerRows.join(',');
				this.dialogVisibleBuy = false;
			},
			//对接员弹窗的 保存
			oneonSubmit() {
				this.abutmenter = this.oneerSelection.join(',');
				this.filter.dockIds = this.oneerRows.join(',');
				this.dialogVisibleOne = false;
			},
			// 知产员 弹框列表选择分页
			ownerHandleCurrentChange(val) {
				this.ownerFilter.pageNum = val;
				this.getUserOwnerData();
			},
			// 购买员 弹框列表选择分页
			buyerHandleCurrentChange(val) {
				this.buyerFilter.pageNum = val;
				this.getUserBuyerData();
			},
			//对接员的 弹窗列表的选择分页
			oneerHandleCurrentChange(val) {
				this.oneerFilter.pageNum = val;
				this.getUserOneerData();
			},
			// 知产员弹框列表选择分页size
			ownerHandleSizeChange(val) {
				this.ownerFilter.pageSize = val;
				this.ownerFilter.pageNum = 1;
				this.getUserOwnerData();
			},
			// 购买员弹框列表选择分页size
			buyerHandleSizeChange(val) {
				this.buyerFilter.pageSize = val;
				this.buyerFilter.pageNum = 1;
				this.getUserBuyerData();
			},
			// 对接员弹框列表选择分页size
			oneerHandleSizeChange(val) {
				this.oneerFilter.pageSize = val;
				this.oneerFilter.pageNum = 1;
				this.getUserOneerData();
			},
			//知产员弹窗 点击其他地方关闭 
			closeOwnerDialog() {
				this.ownerFilter.deptId = '';
				this.ownerFilter.pageNum = 1;
				this.ownerFilter.pageSize = 10;
                this.dialogVisible = false
			},
			//购买员弹窗 点击其他地方关闭 
			closeBuyerDialog() {
				this.buyerFilter.deptId = '';
				this.buyerFilter.pageNum = 1;
				this.buyerFilter.pageSize = 10;
                this.dialogVisibleBuy = false
			},
			//对接员弹窗 点击其他地方关闭 
			closeIOneerDialog() {
				this.oneerFilter.deptId = '';
				this.oneerFilter.pageNum = 1;
				this.oneerFilter.pageSize = 10;
                this.dialogVisibleOne = false
			},
			//知产员 弹窗的  左上角的 部分选择 
			selectSeller(val) {
				this.getUserOwnerData();
			},

			//购买员 弹窗的  左上角的 部分选择 
			selectSellerBuy(val) {
				this.getUserBuyerData();
			},

			//对接员 弹窗的  左上角的 部分选择 
			selectSellerOne(val) {
				this.getUserOneerData();
			},

			//品牌列表的 模糊搜索用到
			getBrandList(val) {
				this.$store.dispatch('getSelfBrandsList').then((res) => {
					 if(res){
					 	this.brandList = res.data.data;
						this.brandList.map(list => {
							Vue.set(list, 'value', list.brandName)
						})
					 }
				})
			},

			//品牌列表的模糊搜索
			querySearch(queryString, cb) {
				let restaurants = this.brandList;
				let results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
				// 调用 callback 返回建议列表的数据
				clearTimeout(this.timeout);
				this.timeout = setTimeout(() => {
					cb(results);
				}, 500 * Math.random());
			},
			//品牌列表的模糊搜索
			createFilter(queryString) {
				return(state) => {
					return(state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
				};
			},
			//品牌列表的模糊搜索
			handleSelect(item) {
//				console.log(item)
				this.filter.brandName = item.brandName;
			},

			//联系人的模糊搜索
			querySearchAsync(queryString, cb) {
				let restaurants = this.contactList;
				let results = queryString ? restaurants.filter(this.createFilterOne(queryString)) : restaurants;
				// 调用 callback 返回建议列表的数据
				clearTimeout(this.timeout);
				this.timeout = setTimeout(() => {
					cb(results);
				}, 500 * Math.random());
			},
			
			//联系人的模糊搜索
			createFilterOne(queryString) {
		        return (state) => {
//		        	console.log(state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
		        	if(state.value == null){
		        		return false;
		        	}else{
		          		return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0 ) ; 
		        	}

		        };
		      },
			//联系人的模糊搜索
			handleSelectAsync(item) {
//				 console.log(item)
				this.filter.contactName = item.contactName;
			},

		},
		computed: {
			...mapGetters({
				'deleteBrand': 'getDeleteBrand',
				'pageTabsList': 'getPageTabsList'
			})
		},
		created() {
			//pageTab
			if(process.BROWSER_BUILD) {
				if(this.pageTabsList[this.pageTabsList.length - 1].name == 'CRM') {
					let arr = this.pageTabsList;
					arr[arr.length - 1].name = this.tabName;
					this.$store.commit('PAGETABSLIST', {
						data: arr
					})
				}
			}

			this.getBrandList();
//			this.getCustomers();
		},
		mounted() {
			
			var year = this.$route.query.year;
            var month = this.$route.query.month < 10 ? '0' + this.$route.query.month : this.$route.query.month;
            var date = this.$route.query.date < 10 ? '0' + this.$route.query.date : this.$route.query.date;
            var CustomerLevels = this.$route.query.CustomerLevels;
            var LevelsName = this.$route.query.LevelsName;
            var usIds = this.$route.query.usIds;
            
            if (this.$route.query.year && this.$route.query.year != '') {
                this.PlanTime = [returnDate(year + '-' + month + '-' + date + ' 00:00:00'),returnDate(year + '-' + month + '-' + date + ' 23:59:59')]
                setToken('parentUrl',"calenderDetail")
            }
            if(this.$route.query.CustomerLevels && CustomerLevels) {
                this.filter.CustomerLevels = CustomerLevels;
                this.category.name = LevelsName;
            }else if(this.$route.query.CustomerLevels && this.$route.query.CustomerLevels == '') {
                this.filter.CustomerLevels = '';
                this.category.name = ''
            }
            else if(this.$route.query.LevelsName == 1){
            	this.filter.energencyFlag = 1;
            }
            if(this.$route.query.usIds && this.$route.query.usIds != ''){
            	this.filter.knowledgeIds = usIds;
            	this.filter.purchaseIds = usIds;
            	this.filter.dockIds = usIds; 
            }
          	if(this.$route.query.calendarFlag == 1 && this.$route.query.calendarFlag){
				this.filter.calendarFlag = 1;
			}
			this.getUserData();
			
		}
	}
</script>

<style lang="scss">
	.customer-box {
		.el-table__body-wrapper{
		  z-index:2
		}
		.el-table .info-row {
			background: #c9e5f5;
		}
		.el-table .asds>div{
    		padding: 0px;
    	}
		.operator-btn {
			.el-button {
				margin-left: 5px!important;
			}
		}
		.el-form {
			.el-form-item {
				width: 70%
			}
			
			.operator-btn {
				text-align: center;
				padding: 0 10px;
			}
			.el-input,
			.el-select,
			.el-cascader,
			.el-date-picker {
				width: 100%
			}
		}
		.action_col {
			position: relative
		}
		.customer_row {
			margin-top: 20px;
			background-color: #ff0000;
			.el-table {}
		}
		.shenhedialog {
			.el-form-item {
				margin-left: 10%;
			}
			.el-textarea {
				width: 80%;
			}
		}
		.paging {
			margin-top: 15px;
		}
		.customer_col {
			cursor: pointer;
			color: #1488FF;
			span {
				display: block;
				a {
					text-decoration: none;
					color: #20a0ff;
				}
				img {
					margin-right: 5px;
					cursor: pointer
				}
			}
		}
		tbody {
			font-size: 14px;
		}
		.signRow {
			background-color: #00ee00;
		}
		.trans_button_col {
			text-align: center;
			margin-top: 15px
		}
		.top_close {
			float: left;
			margin-left: 20px;
			margin-top: 20px;
		}
		.top_close,
		.top_save {
			margin: 0 20px;
		}
		.top_save {
			float: right;
		}
		.shenhejilu {
			.reasons {
				margin-left: 84.5px;
				word-break: break-word;
			}
		}
		.el-col-3 {
			margin-left: 20px;
		}
	}
</style>